public class ServerEvaluator {
	private IRCServer server;

	public ServerEvaluator(IRCServer server) {
		this.server = server;
	}

	public void EvalCommand(IRCCommand cmd, User user) {
		if (cmd.getCommand().equalsIgnoreCase("privmsg")) {
			handlePrivmsg(cmd);
			// } else if (cmd.getCommand().equalsIgnoreCase("ping")) {
			// handlePing(cmd);
		} else if (cmd.getCommand().equalsIgnoreCase("JOIN")) {
			handleJoin(cmd, user);
		} else if (cmd.getCommand().equalsIgnoreCase("part")) {
			handlePart(cmd, user);
		} else if (cmd.getCommand().equalsIgnoreCase("quit")) {
			handleQuit(cmd);
		} else if (cmd.getCommand().equalsIgnoreCase("nick")) {
			handleNick(cmd, user);
			// } else if (cmd.getCommand().equalsIgnoreCase("kick")) {
			// handleKick(cmd);
			// } else if (cmd.getCommand().equalsIgnoreCase("topic")) {
			// handleTopic(cmd);
		//} else if (cmd.getCommand().equalsIgnoreCase("notice")) {
			//handleNotice(cmd);
		//} else if (cmd.getCommand().equalsIgnoreCase("whois")) {
		//	handleWhois(cmd, user);s
		} else if (cmd.getCommand().equalsIgnoreCase("pong")) {
			handlePong(cmd);
		//} else if (cmd.getCommand().equalsIgnoreCase("away")) {
			//handleAway(cmd);
		} else {
			handleUnknown(cmd);
		}
	}

	private void handlePrivmsg(IRCCommand cmd) {
		
		
		return;
	}

	
	private void handlePong(IRCCommand cmd) {
		
		return;
	}

	private void handleUnknown(IRCCommand cmd) {
		
		return;
	}

	private void handlePart(IRCCommand cmd, User user) {
		server.channelLeaver(cmd.getParameter(0), user);
	}

	private void handleQuit(IRCCommand cmd) {
		
		return;
	}

	private void handleJoin(IRCCommand cmd, User user) {
		server.channelAdder(cmd.getParameter(0), user); 
		
	}

	private void handleNick(IRCCommand cmd, User user) {
		if (!user.isRegistered) {
			if (server.registerOrChangeNick(cmd.getParameter(0), user)) {
				user.setNick(cmd.getParameter(0));
				user.isRegistered = true;
			} else {
				// fill in with klient response later, or wait method?
			}
		} else {

		}
	}

}
